package com.sgl.service;

import com.sgl.dao.OrderMapper;
import com.sgl.entity.MybatisParamVo;
import com.sgl.entity.OrderHistory;
import com.sgl.util.PageBean;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderService{
    @Autowired
    OrderMapper orderMapper;

    public Integer inserOrders(OrderHistory orderHistory){
        Integer integer = orderMapper.inserOrders(orderHistory);
        return integer;
    }

    public List<OrderHistory> findList(PageBean<OrderHistory> pageBean){
        return orderMapper.findList(pageBean);
    }

    public Integer countList(PageBean<OrderHistory> pageBean){
        return orderMapper.countList(pageBean);
    }

    public Integer update(OrderHistory orderHistory){
        return orderMapper.update(orderHistory);
    }

    public Integer delete(@Param("ids") List<String> ids){
        return orderMapper.delete(ids);
    }

    public OrderHistory findOrderByOrderId(String orderId){
        OrderHistory orderHistory = orderMapper.findById(orderId);
         return  orderHistory;
    }

    public List<OrderHistory> findOrderByMerOrderId(PageBean<OrderHistory> pageBean){
        List<OrderHistory> orderHistory=orderMapper.findByMerorderId(pageBean);
        return  orderHistory;
    }

    public Integer updateById(OrderHistory history){
        return orderMapper.updateById(history);
    }

    public  Integer changeStatusByParam(MybatisParamVo<OrderHistory> orders){
        return orderMapper.changeStatusByParam(orders);
    }
}
